import { S } from '../../s';
import { IPSAppCodeList } from '../../app/codelist/ipsapp-code-list';
import { IPSAppDEField } from '../../app/dataentity/ipsapp-defield';
import { IPSAppView } from '../../app/view/ipsapp-view';
import { IPSEditor } from '../ipseditor';
import { IPSDEGrid } from './ipsdegrid';
import { IPSDEGridEditItem } from './ipsdegrid-edit-item';
import { IPSDEGridEditItemUpdate } from './ipsdegrid-edit-item-update';
import { IPSDEGridFieldColumn } from './ipsdegrid-field-column';
import { PSDEGridColumnImpl } from './psdegrid-column-impl';
import { IPSDEUIAction } from '../../dataentity/uiaction/ipsdeuiaction';
import { IPSDEUIActionGroup } from '../../dataentity/uiaction/ipsdeuiaction-group';

export class PSDEGridFieldColumnImpl
  extends PSDEGridColumnImpl
  implements IPSDEGridFieldColumn, IPSDEGridEditItem
{
  get cLConvertMode(): 'NONE' | 'FRONT' | 'BACKEND' {
    return this.M.cLConvertMode;
  }

  get createDV(): string {
    return this.M.createDV;
  }

  get createDVT():
    | 'SESSION'
    | 'APPLICATION'
    | 'UNIQUEID'
    | 'CONTEXT'
    | 'PARAM'
    | 'OPERATOR'
    | 'OPERATORNAME'
    | 'CURTIME'
    | 'APPDATA' {
    return this.M.createDVT;
  }

  get dataItemName(): string {
    return this.M.dataItemName;
  }

  get enableCond(): 0 | 1 | 2 | 3 {
    return this.M.enableCond;
  }

  get excelCaption(): string {
    return this.M.excelCaption;
  }

  protected filterpseditor: IPSEditor;
  getFilterPSEditor(): IPSEditor | null {
    return (
      this.filterpseditor ||
      (this.filterpseditor = this.fillObjectModel(
        S._12e,
        this.M.getFilterPSEditor,
        S._3e8,
      ) as IPSEditor)
    );
  }

  get groupItem(): string {
    return this.M.groupItem;
  }

  get ignoreInput(): 0 | 1 | 2 | 3 {
    return this.M.ignoreInput;
  }

  protected linkpsappview: IPSAppView;
  getLinkPSAppView(): IPSAppView | null {
    return (
      this.linkpsappview ||
      (this.linkpsappview = this.fillObjectModel(
        S._1e,
        this.M.getLinkPSAppView,
        S._2ee,
      ) as IPSAppView)
    );
  }

  get linkValueItem(): string {
    return this.M.linkValueItem;
  }

  get objectIdField(): string {
    return this.M.objectIdField;
  }

  get objectNameField(): string {
    return this.M.objectNameField;
  }

  get objectValueField(): string {
    return this.M.objectValueField;
  }

  get outputCodeListConfigMode(): 0 | 1 | 2 {
    return this.M.outputCodeListConfigMode != null
      ? this.M.outputCodeListConfigMode
      : 0;
  }

  protected psappcodelist: IPSAppCodeList;
  getPSAppCodeList(): IPSAppCodeList | null {
    return (
      this.psappcodelist ||
      (this.psappcodelist = this.fillObjectModel(
        S._8,
        this.M.getPSAppCodeList,
        S._2a2,
      ) as IPSAppCodeList)
    );
  }

  protected psappdefield: IPSAppDEField;
  getPSAppDEField(): IPSAppDEField | null {
    return (
      this.psappdefield ||
      (this.psappdefield = this.fillObjectModel(
        S._1,
        this.M.getPSAppDEField,
        S._2e4,
      ) as IPSAppDEField)
    );
  }

  protected psdegridedititemupdate: IPSDEGridEditItemUpdate;
  getPSDEGridEditItemUpdate(): IPSDEGridEditItemUpdate | null {
    if (this.psdegridedititemupdate != null) return this.psdegridedititemupdate;
    const value = this.M.getPSDEGridEditItemUpdate;
    if (value == null) {
      return;
    }
    const ipsdegrid = this.getParentPSModelObject(S._24d) as IPSDEGrid;
    if (ipsdegrid != null) {
      this.psdegridedititemupdate = ipsdegrid.findPSDEGridEditItemUpdate(value);
    }
    return this.psdegridedititemupdate;
  }

  protected psdeuiaction: IPSDEUIAction;
  getPSDEUIAction(): IPSDEUIAction | null {
    return (
      this.psdeuiaction ||
      (this.psdeuiaction = this.fillObjectModel(
        S._288,
        this.M.getPSDEUIAction,
        S._2f7,
      ) as IPSDEUIAction)
    );
  }

  protected psdeuiactiongroup: IPSDEUIActionGroup;
  getPSDEUIActionGroup(): IPSDEUIActionGroup | null {
    return (
      this.psdeuiactiongroup ||
      (this.psdeuiactiongroup = this.fillObjectModel(
        S._20f,
        this.M.getPSDEUIActionGroup,
        S._2e6,
      ) as IPSDEUIActionGroup)
    );
  }

  protected pseditor: IPSEditor;
  getPSEditor(): IPSEditor | null {
    return (
      this.pseditor ||
      (this.pseditor = this.fillObjectModel(
        S._12e,
        this.M.getPSEditor,
        S._2f0,
      ) as IPSEditor)
    );
  }

  get resetItemName(): string {
    return this.M.resetItemName;
  }

  get textSeparator(): string {
    return this.M.textSeparator;
  }

  get treeColumnMode(): 0 | 1 | 2 | 3 | 8 | 4 | 12 {
    return this.M.treeColumnMode != null ? this.M.treeColumnMode : 0;
  }

  get unitName(): string {
    return this.M.unitName;
  }

  get unitNameWidth(): number {
    return this.M.unitNameWidth != null ? this.M.unitNameWidth : 0;
  }

  get updateDV(): string {
    return this.M.updateDV;
  }

  get updateDVT():
    | 'SESSION'
    | 'APPLICATION'
    | 'UNIQUEID'
    | 'CONTEXT'
    | 'PARAM'
    | 'OPERATOR'
    | 'OPERATORNAME'
    | 'CURTIME'
    | 'APPDATA' {
    return this.M.updateDVT;
  }

  get valueFormat(): string {
    return this.M.valueFormat;
  }

  get valueItemName(): string {
    return this.M.valueItemName;
  }

  get valueSeparator(): string {
    return this.M.valueSeparator;
  }

  get valueType():
    | 'SIMPLE'
    | 'SIMPLES'
    | 'OBJECT'
    | 'OBJECTS'
    | 'USER'
    | 'USER2' {
    return this.M.valueType || 'SIMPLE';
  }

  get allowEmpty(): boolean {
    return this.M.allowEmpty;
  }

  get convertToCodeItemText(): boolean {
    return this.M.convertToCodeItemText != null
      ? this.M.convertToCodeItemText
      : false;
  }

  get enableItemPriv(): boolean {
    return this.M.enableItemPriv != null ? this.M.enableItemPriv : false;
  }

  get enableLinkView(): boolean {
    return this.M.enableLinkView != null ? this.M.enableLinkView : false;
  }

  get enableRowEdit(): boolean {
    return this.M.enableRowEdit != null ? this.M.enableRowEdit : false;
  }

  get enableUnitName(): boolean {
    return this.M.enableUnitName != null ? this.M.enableUnitName : false;
  }

  get needCodeListConfig(): boolean {
    return this.M.needCodeListConfig != null
      ? this.M.needCodeListConfig
      : false;
  }
  get cls(): string {
    return 'PSDEGridFieldColumnImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._c4 || cls == S._c9) return true;
    return super.instanceof(cls);
  }
}
